home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / igps_102.zip / MPHONE.CPP < prev    next >
C/C++ Source or Header  |  1994-06-23  |  5KB  |  169 lines

  1. ////////////////////////////////////////////////////////////////////////////////////
  2. // Internet Global Phone Project
  3. // mphone.cpp : implementation file for the IGP application CWinApp class
  4. //
  5. // Very little modification to the AppWizard generated MFC skeleton. Note only
  6. // the mapping of the CWinApp Idle loop to the CPhoneView Idle loop to handle
  7. // the background audio compression/de-compression threads.
  8. ////////////////////////////////////////////////////////////////////////////////////
  9. // Copyright (c) 1993-1994    microWonders Inc.  All rights reserved.
  10. //                                                                         
  11. // AN OPEN INVITION TO BUILD UPON AND CONTRIBUTE TO THE PUBLIC TECHNOLOGY POOL:
  12. // You are encouraged to redistribute, and build upon the technologies presented 
  13. // in this source module and the accompanying article in Dr. Dobb's Journal provided 
  14. // all the conditions listed in the MUSTREAD.TXT file, included with this 
  15. // distribution, are met.
  16. ////////////////////////////////////////////////////////////////////////////////////
  17.  
  18.  
  19. #include "stdafx.h"  
  20. #include "mmsystem.h"
  21. #include "mphone.h"
  22.  
  23. #include "mainfrm.h"
  24. #include "phonedoc.h"
  25. #include "wsmin.h"
  26. #include "socket.h" 
  27. #include "talksock.h"
  28. #include "phonevw.h"
  29.  
  30.  
  31. #ifdef _DEBUG
  32. #undef THIS_FILE
  33. static char BASED_CODE THIS_FILE[] = __FILE__;
  34. #endif
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CPhoneApp
  38.  
  39. BEGIN_MESSAGE_MAP(CPhoneApp, CWinApp)
  40.     //{{AFX_MSG_MAP(CPhoneApp)
  41.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  42.         // NOTE - the ClassWizard will add and remove mapping macros here.
  43.         //    DO NOT EDIT what you see in these blocks of generated code!
  44.     //}}AFX_MSG_MAP
  45.     // Standard file based document commands
  46.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  47.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  48. END_MESSAGE_MAP()
  49.  
  50. /////////////////////////////////////////////////////////////////////////////
  51. // CPhoneApp construction
  52.  
  53. CPhoneApp::CPhoneApp()
  54. {
  55.     // TODO: add construction code here,
  56.     // Place all significant initialization in InitInstance
  57. }
  58.  
  59. /////////////////////////////////////////////////////////////////////////////
  60. // The one and only CPhoneApp object
  61.  
  62. CPhoneApp NEAR theApp;
  63.  
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CPhoneApp initialization
  66.  
  67. BOOL CPhoneApp::InitInstance()
  68. {
  69.  
  70.     // Standard initialization
  71.     // If you are not using these features and wish to reduce the size
  72.     //  of your final executable, you should remove from the following
  73.     //  the specific initialization routines you do not need.
  74.  
  75.     SetDialogBkColor();        // Set dialog background color to gray
  76.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  77.  
  78.     // Register the application's document templates.  Document templates
  79.     //  serve as the connection between documents, frame windows and views.
  80.  
  81.     CSingleDocTemplate* pDocTemplate;
  82.     pDocTemplate = new CSingleDocTemplate(
  83.         IDR_MAINFRAME,
  84.         RUNTIME_CLASS(CPhoneDoc),
  85.         RUNTIME_CLASS(CMainFrame),     // main SDI frame window
  86.         RUNTIME_CLASS(CPhoneView));
  87.     AddDocTemplate(pDocTemplate);
  88.  
  89.     // create a new (empty) document
  90.     OnFileNew();
  91.  
  92.     if (m_lpCmdLine[0] != '\0')
  93.     {
  94.         // TODO: add command line processing here
  95.     }
  96.  
  97.  
  98.     return TRUE;
  99. }
  100.  
  101. /////////////////////////////////////////////////////////////////////////////
  102. // Idle Processing for Compression and Decompression
  103.  
  104. BOOL CPhoneApp::OnIdle(LONG lCount)
  105. {
  106.     BOOL bMore = CWinApp::OnIdle(lCount);
  107.     // do compression or decompression every moment we have  
  108.     if (m_OnlyView)
  109.     {
  110.      bMore = ((CPhoneView *)(m_OnlyView))->DoIdleProcessing();   // neat!
  111.     }
  112.     return bMore;
  113.      // return TRUE as long as there is any more idle tasks
  114.  
  115. }
  116.  
  117.  
  118.  
  119. /////////////////////////////////////////////////////////////////////////////
  120. // CAboutDlg dialog used for App About
  121.  
  122. class CAboutDlg : public CDialog
  123. {
  124. public:
  125.     CAboutDlg();
  126.  
  127. // Dialog Data
  128.     //{{AFX_DATA(CAboutDlg)
  129.     enum { IDD = IDD_ABOUTBOX };
  130.     //}}AFX_DATA
  131.  
  132. // Implementation
  133. protected:
  134.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  135.     //{{AFX_MSG(CAboutDlg)
  136.         // No message handlers
  137.     //}}AFX_MSG
  138.     DECLARE_MESSAGE_MAP()
  139. };
  140.  
  141. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  142. {
  143.     //{{AFX_DATA_INIT(CAboutDlg)
  144.     //}}AFX_DATA_INIT
  145. }
  146.  
  147. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  148. {
  149.     CDialog::DoDataExchange(pDX);
  150.     //{{AFX_DATA_MAP(CAboutDlg)
  151.     //}}AFX_DATA_MAP
  152. }
  153.  
  154. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  155.     //{{AFX_MSG_MAP(CAboutDlg)
  156.         // No message handlers
  157.     //}}AFX_MSG_MAP
  158. END_MESSAGE_MAP()
  159.  
  160. // App command to run the dialog
  161. void CPhoneApp::OnAppAbout()
  162. {
  163.     CAboutDlg aboutDlg;
  164.     aboutDlg.DoModal();
  165. }
  166.  
  167. /////////////////////////////////////////////////////////////////////////////
  168. // CPhoneApp commands
  169.